{include file="header"}
<div class="layui-fluid">
    <div class="layui-row">
        <form class="layui-form">
            <div class="layui-form-item">
                <label class="layui-form-label">
                    <span class="x-red">*</span>作品名称
                </label>
                <div class="layui-input-block">
                    <input type="text" name="name" placeholder="{:lang('please.enter')}作品名称" autocomplete="off" class="layui-input" value="">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">
                </label>
                <button  class="layui-btn" lay-filter="add" lay-submit="">
                    {:lang('add')}
                </button>
            </div>
        </form>
    </div>
</div>
{include file="footer"}
<script>
    layui.use(['form', 'layer'], function() {
        $ = layui.jquery;
        var form = layui.form,
            layer = layui.layer;

        //监听提交
        form.on('submit(add)', function(data) {
            request("POST",'{:url("Television/worksadd")}',data.field,function (res,msg) {
                //发异步，把数据提交给php

                layer.alert(msg, {icon: 6}, function() {
                    xadmin.close();
                    // 可以对父窗口进行刷新
                    xadmin.father_reload();
                });
            })

            return false;
        });

    });
</script>